/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.app.course.practice.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.app.course.practice.entity.TafterPractice;
import com.jeesite.modules.app.course.practice.dao.TafterPracticeDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 课后练习表Service
 * @author zpp
 * @version 2020-01-26
 */
@Service
@Transactional(readOnly=true)
public class TafterPracticeService extends CrudService<TafterPracticeDao, TafterPractice> {
	
	/**
	 * 获取单条数据
	 * @param tafterPractice
	 * @return
	 */
	@Override
	public TafterPractice get(TafterPractice tafterPractice) {
		return super.get(tafterPractice);
	}
	
	/**
	 * 查询分页数据
	 * @param tafterPractice 查询条件
	 * @param tafterPractice.page 分页对象
	 * @return
	 */
	@Override
	public Page<TafterPractice> findPage(TafterPractice tafterPractice) {
		return super.findPage(tafterPractice);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param tafterPractice
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(TafterPractice tafterPractice) {
		super.save(tafterPractice);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(tafterPractice.getId(), "tafterPractice_image");
		// 保存上传附件
		FileUploadUtils.saveFileUpload(tafterPractice.getId(), "tafterPractice_file");
	}
	
	/**
	 * 更新状态
	 * @param tafterPractice
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(TafterPractice tafterPractice) {
		super.updateStatus(tafterPractice);
	}
	
	/**
	 * 删除数据
	 * @param tafterPractice
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(TafterPractice tafterPractice) {
		super.delete(tafterPractice);
	}
	
}